﻿using System.Windows.Controls;

namespace WPFTestSolution.Pages.Controls.ItemsControls.Selectors {

    /**
     * https://www.bilibili.com/video/BV1bV411A7Eq?p=57
     * 057-TabControl控件(: Selector)
     * https://www.wpfsoft.com/2023/09/06/1890.html
     */
    public partial class _57_TabControl_Page : Page {
        public _57_TabControl_Page() {
            InitializeComponent();
            this.Title = "057-TabControl控件(: Selector)";
        }

        private void _tabControl_SelectionChanged(object sender, SelectionChangedEventArgs e) {
            if (!(sender is TabControl tabControl)) return;
            
            if (!(tabControl.SelectedItem is TabItem tabItem)) return;
            
            var content = tabControl.SelectedContent;
            _textBlock.Text = $"标题: {tabItem.Header}, 内容:{content}";
        }
    }
}